extends "../../azurlane_ctrl/AzurItem.gd"
func init():
	.init()
	name = "[稀有]勇敢的美梦之枕"
	info = "战斗开始时，佩戴者进入无法被唤醒的沉睡状态，并使所有攻击她的敌人也进入10秒<沉睡>状态\n[color=#DC143C]同时装备两件时可升级[/color]"
	price = 300
	att.def = -30
	att.dod = -30

func _connect():
	._connect()
	masCha.connect("onHurt", self, "onHurt")
	sys.main.connect("onBattleStart",self,"start")

func start():
	if utils.inBattle(masCha):
		masCha.addBuff(b_zhentou.new())	

func onHurt(atkInfo):
	if atkInfo.atkType != sys.AtkType.EFF:
		masCha.castBuff(atkInfo.atkCha, buff.b_chenShui.new(10))

func upgrade():
	name = "[color=#FFFF00][史诗]勇敢的美梦之枕"
	info = "战斗开始时，佩戴者进入无法被唤醒的沉睡状态，并使所有攻击她的敌人也进入10秒沉睡状态(可唤醒)"
	att.def = 0
	att.dod = 0

#沉睡
class b_zhentou:
	extends "../../azurlane_ctrl/AzurBuff.gd"
	var eff2
	func _init():
		attInit()
		id = "b_zhentou"
		isNegetive = true
		buffName = "永眠"
		dispel = 2
	func _connect():
		._connect()
		masCha.aiOn = false
		masCha.enableCastSkill = false
		eff2 = sys.newEff("animEff", masCha.position)
		eff2.setImgs(sys.getBasePath() + "/eff/sleep", 6, true)
		eff2.scale *= 0.8
		eff2.normalSpr.position=Vector2(0, -10)
	func _del():
		._del()
		masCha.aiOn = true
		masCha.enableCastSkill = true
		if is_instance_valid(eff2):
			eff2.queue_free()
	func _process(delta):
		if masCha != null && is_instance_valid(eff2):
			eff2.position = masCha.position